package com.esri.core.geometry;

import java.util.Collections;
import java.util.HashMap;
import java.util.Map;

/* loaded from: classes.dex */
class ObjectCacheTable<K, T> {
    private Object[] b;
    private boolean[] c;
    private Map<K, T> a = Collections.synchronizedMap(new HashMap());
    private int d = 0;

    public ObjectCacheTable(int i) {
        this.b = new Object[i];
        this.c = new boolean[i];
        for (int i2 = 0; i2 < i; i2++) {
            this.c[i2] = false;
        }
    }

    boolean a(K k) {
        return this.a.containsKey(k);
    }

    T b(K k) {
        return this.a.get(k);
    }

    void a(K k, T t) {
        boolean[] zArr = this.c;
        int i = this.d;
        if (zArr[i]) {
            zArr[i] = false;
            this.a.remove(this.b[i]);
        }
        this.a.put(k, t);
        Object[] objArr = this.b;
        int i2 = this.d;
        objArr[i2] = k;
        this.c[i2] = true;
        this.d = (i2 + 1) % objArr.length;
    }
}
